Top 10k strings from Interactive BASIC Programming (1985)(Eigen Software)(Tape 3 of 3 Side B).tzx
in <root> / bin / z80 / software / Sinclair Spectrum Collection TOSEC.exe / Sinclair ZX Spectrum - Utilities & Educational / Sinclair ZX Spectrum - Utilities & Educational - [TZX] (TOSEC-v2007-01-01) /
Back to the directory listing
8 ;" "; 6 ;" "; 5 a$(i,heading) 5 ;"a file": 4 ;"7 List files" 4 ;"5 Amend a file"; 4 ;"4 Insert in file"; 4 ;"3 Load data from tape"; 4 ;"2 Save data to tape"; 4 ;"1 Set up the system"; 3 total=total+1 3 no key or invalid key or wall encountered 3 must be right! 3 Interactive 3 ;a$ (fileno,i) 3 ;"Select an option from 1 to 7" 3 ;"6 Search for string"; 3 ," ",24 3 ," ",16 3 ," ",14 3 ," ",9 3 ," ",30 3 ," ",23 3 ," ",21 3 ," ",23 3 ," ",22 3 ," ",16 3 ," ",20 3 ," ",19 3 ," ",4 3 ," ",2 3 ," ",1 3 ," " 3 "Enter name for data ";f$ 3 THEN GOTO 3 IF INKEY$ 2 now move gobble blob 2 h(1)=g(1): 2 find new position 2 direction=151 2 direction=149 2 direction=147 2 direction=145 2 c$> arraylength 2 c$=a$(k,heading)(j 2 arraylength=i 2 a$(k,heading)(i 2 a$ (total,i) =g$ 2 RANDOMIZE USR 2 Programming 2 PRINT PAPER 2 ;"toggle sound: SPACE & ENTER" 2 ;"help: CAPS SHIFT & ENTER"; 2 ;"forward: SYMBOL SHIFT & SPACE"; 2 ;"file number ";fileno; 2 ;"backward: SYMBOL SHIFT & ENTER"; 2 ;"WARNING: if you enter 2 ;"Sorry, your name is too long (maximum 9 characters).": 2 ;"Sorry, too long. Try again.": 2 ;"Select the heading under which the search is to be carried out (press 1-3)" 2 ;"Please ENTER the string to be sought:" 2 ;"Loading, please wait!" 2 ;"Interactive BASIC Programming"; 2 ;"Further amendments? (y/n):" 2 ;"Enter the ";e$;" heading: " 2 ;"ENTER item ";i 2 ;"Copyright 2 ;"Another file? (y/n):" 2 ;" " 2 ;" "; 2 ;" "; 2 , it must be followed by 2 +arraylength- 2 (h(1),h(2)) 2 "first","second","third" 2 "Would you like to look for another string? (y/n) ";c$ 2 "I don't have that one!": 2 "File ";k;" ";a$(k,heading) 2 the Solution, then 2 t(1),t(2);" 2 h(1)=s(1) 2 direction 2 a$(i,heading) 2 a$(10,3,20) 2 THEN GOTO 2 Run the program. 2 PRINT AT 2 1985 Eigen Software" 2 Look at the program foundin this Learning Element. 2 PRINT 2 EIGEN SOFTWARE"; 2 create reality" 1 you must use 1 will eventually become equalto 1 will equal the totalnumber of dots and the game should end. To prepare for this add: 1 tostore the next row and column which are found by considering the current key press 1 to mean keepold option. Ask whether further amendments are required. Finally, give the option to amend other files. 1 to go to the appropriate line ( 1 to get the number 1 - 7. 1 to change 1 then save main array under 1 tab,a$ 1 t(2)=s(2): 1 t(1)=g(1) 1 statement to store column numbers for 1 statement if youwant but do not alter any UDG other than GRAPHIC A. (Use the line numbers given above.) 1 so add: 1 should bechanged from 1 score=score+1: 1 score=score+1 1 score=maxdot 1 s(1)=t(1) 1 s(1),s(2);" ": 1 s(1),s(2);" 1 not greater than 20. The sought string is stored in 1 module l 1 module k 1 maxdot=337 1 j;" ";a$(j,i) 1 i 6930 1 i 1 h(2)=g(2): 1 h(2)=g(2)-1: 1 h(2)=g(2)+1: 1 h(2)=g(2) 1 h(1)=g(1)+1: 1 for this. Don't worry about starting values, we'll sort them out later. 1 for the line number. 1 f$;" files now saved." 1 f$;" files now saved" 1 f$;" files now loaded" 1 etc. Add theBASIC from line 5300 1 doesn't change if 1 change the 1 can be occupied by the gobble blob then we must test for an energy dot, space or ghost. In the case of the dotthe score must be increased. For the ghost the gobble blob iscaptured and the game ends. 1 c$=a$(k,heading)(j 1 c$ 1 arraylength=i 6940 1 appears in 1 and using 1 and the options at 1 and heading array under 1 and head- ing array under 1 and add to line 1 and 1 all parts of yourprogram together. 1 a$(total,1) 1 a$(fileno,i)=h$ 1 a$(fileno,i) =h$ 1 a$(10,3,20) 1 a$ (200, 3, 20) 1 a 420 1 When the computer gets to line 1 Use CAPS SHIFT and GRAPHICS {GRAPH} to get in graphics mode and then press keys b through to m to see the required UDGs. Write some BASIC that would produce these (or some of your own graphics.) 1 Then wait for a key to be pressed before returning to menu." 1 Then ask for each heading in turn and assign it to 1 The more you program your Spectrum the easier it becomes. Remember: you're only limited byyour own imagination! 1 THEN PRINT 1 THEN GOTO 1 Softwarea 1 Set up MAze 1 PRINT INK 1 New ghost position 1 Moving the munching chappie in specific directions 1 Moving the munching chappie 1 MODULE L 1 MODULE K 1 If you have any problems write or telephone Eigen Software 1 INKEY$ IF CODE 1 INKEY$ 1 EIGEN SOFTWARE 45 Bancroft Road, WIDNES Cheshire WA8 OLR 051 - 423 6201 1 Created with Ramsoft MakeTZX 1 Change ghost direction 1 Caught! Game over 1 All dots eaten! Game over 1 ;i;" ";b$(i) 1 ;i;" ";b$(i) 1 ;a$(fileno,i) 1 ;"sploge in the way?"; 1 ;"direction"; 1 ;"a file.": 1 ;"YOU ARE DOOMED TO WRAITHDOM" 1 ;"Would you like to insert anotherfile? (y/n)" 1 ;"Would you like to insert another file?(y/n)" 1 ;"Wall in the way?" 1 ;"To insert a file we mustincrease 1 ;"This will be programmed as a loop that checks for keys 1-7 being pressed and then causes a jump (GOTO) to a part of the program that deals with the selected option." 1 ;"Sorry your name is too long (maximum 9 characters).": 1 ;"Press ENTER" 1 ;"PRESS ANY KEY FOR ANOTHER GAME" 1 ;"Must be "" "" or "" 1 ;"Move ghost" 1 ;"Learning Module L" 1 ;"Learning Module K" 1 ;"Is the gobble"; 1 ;"Get new"; 1 ;"Game over"; 1 ;"GAME OVER"; 1 ;"Find new position"; 1 ;"ENTER";b$(i) 1 ;"ENTER ";b$(i) 1 ;"Copy on to paper the menu given above, then press any key." 1 ;"Caught!"; 1 ;"CAUGHT!!"; 1 ;"Amending with ENTER only will retain the old item." 1 ;"Amending with ENTER only will retain the old item." 1 ;"A file": 1 ;"6 Search for a string"; 1 ;"(GOSUB"; 1 ;"(GOSUB 7200)" 1 ;" Press any key to continue" 1 ;" ";#0 1 ;" score = 0 y-up b-down g-left h-right" 1 9000 4130 1 8;"Wilde" 1 7 410 1 5330 5320 1 5000 4100 1 4130 4120 1 4100 4030 1 4100 4020 1 4100 4050 1 4100 4010 1 30,115,254,240,224,240,127,30 1 3 1 21 1170 1 1+arraylength- 1 1 1160 1 1 1150 1 0,0,0,24,24,0,0,0 400 1 0," ",0," ",23," ",31," ",0, " ",3," ",9," " 1 ....... 1 ..... statements. 1 ..... 1 . Write this subroutine, putting it at lines 1 . Write Option 3 now and then save it to tape with Option 2. ( 1 . We will be check- ing this against 1 . Update all four 1 . These areeasily dealt with. Just add an amusing message and some sound! 1 . There isn't a colour 1 . There are many possibilities. 1 . The idea is to find 1 . Start with 1 . So ifthe 1 . Returnfinally, to the menu. 1 . Repeat until old 1 . Checking for this first will make the search quicker. Unfortunately 1 . Can you see whythis problem doesn't arise for 1 . We hope you have enjoyed yourself and you now have a goodgrasp of ZX BASIC. We have explained each topic in simple terms. You should now read the manual {buy the old Spectrum manual, it's very good!} in order to familiarize yourself with the more subtle aspects of programing. 1 . This would give us a maximum of 200 files, each consisting of three items. Each item can be as many as 200 characters long. While we are developing the program there will not be enoughroom for such a large array so we will use 1 . Try to write a statement that uses 1 . This must be done for the main array and the heading array. Display a message that tells theuser to keep the tape running between the two 1 . We'll start the menu part at line 1 . (Don't accept 1 . Amend 1 . Alternatively: 1 . You can easily adapt the filing program we are about to produce in a way that suits you best (see later). 1 , until a new direction is found. 1 , three headings of 20 characters) then they can be saved to tape with the main array later on." 1 , the wall squares will not show 1 , print headings, use a loop to print files. (See the plan). 1 , check forstring length less than 10 and save. 1 , please send it to us stating where and when it was bought. We will refund your postage and send you a genuine copy of the program. (b) Please do not make copies for your friends. If low sales drive us out of business you will be unable to buy our future products (they won't exist!) (c) If you are using a tape copied from a friend, please send us a cheque or postal order for the RRP minus `1.50 and enclose an explanatorynote. We will send you a proper copy and a thankyou letter. 1 ). Write the BASIC for option 2. 1 ). There will be a loopso that each file can be considered in turn. Within this loop the actual search will be carried out. 1 ). Write a single line of BASIC that performs this. 1 ) then print the headings and old items ( 1 ) then ask for sought string ( 1 ) is increased by one if a dot is found. Start at line 1 ) etc. And 1 ) as a fourth element of the headingarray so that it can be saved toand loaded from tape. Obviously we will need to use 1 ) and the ghost ( 1 ) if the next position is the ghost.Also the score (held in variable 1 ) is a dot or space or (b) ends the game ( 1 ) * Write routines that allow the gobble character to move up, down, left and right as instructed by the keyboard * Routines for moving ghosts that allow for the capture of 1 (t(1),t(2)) 1 (h(1),h(2))= 1 (direction+mouth) 1 (c) The character in the new position is saved 1 (You have to do this because when Interactive BASIC Programming is not in your Spectrum the required UDGs will not be available.) Because we need only create the UDGs once, put the BASIC at line 1 (He was a colourful character!). 1 "some name" 1 "a"+i,a 430 1 "Which file do you want to amend? ";fileno 1 "Which file do you want to amend? "; filno 1 "We'll deal with each option individually. It will probably be more convenient for you to make a few notes about this planrather than keep referring back to this Learning Element." 1 "Then display new version of fileand ask whether futher amend- ments are required. Finally, give the option of amending other files or return- ing to menu." 1 "Then ask for an amended version of each item and take input of an empty string (i.e. just press-ing ENTER) as meaning keep old item." 1 "Sorry,item";i;" is to long. Try again": 1 "Sorry, item ";i;" is to long."'"Try again": 1 "Options1&2" 1 "For the motion:";#0 1 "Finally, give choice if creatinganother file or going back to menu." 1 "Finally give the option to search for other strings or return to menu." 1 "ENTER name for data" 1 "7 List files: 1 "6 Search for a string: This is the hardest option.First ask for the heading under which the search is to be carried out (input number from 1to 3 and store heading). Ask for string to be sought ( 1 "5 Amend a file: Ask for the file number( 1 "4 Insert a file: This option will allowfor files to be added to those already created. We need to havea variable that holds the total number of files existing at any one time so we know where to create the next file. We'll savethis variable (called 1 "3 Load data from tape: Ask for 1 "2 Save data to tape: Ask for 1 "1 Set up the system : We need to give headings to the file items. If these headings are stored in an array ( 1 ") of the next position so that it can be restored when the ghost moves on. Use 1 ""Enter "";b$;"":"": 1 " use: 1 " at the moment but this will be lost when the program is saved. To create " 1 " at the new position. Finally, update 1 " We must bear in mind that a score will have to be kept and displayed (use the bottom part of the screen for this)." 1 " Writing the game consists of these parts:" 1 " * Draw maze and insert energy pills * Invent UDGs for the gobble characters ( 1 " ask for item headings, clear main array, set number of files to 0 (see option 4)" 1 " 1180 1 " 1 your amended version to tape. 1 xxxxx 1 will always be 20. We need a subroutine that will count the number of characters in 1 we strive to produce original and useful software that is good value for money. You can help us to produce this software, simply byremaining vigilant and honest. 1 total 6400 1 total 1 to test for a space. If not a spacethen assume it to be a dot and increase the score. Then check to see if the gobble has been caught ( 1 to storea number giving the direction: 0 for up, 1 for down, 2 for leftand 3 for right. 1 to put in the "energy dots" and they won't appear on the walls. Use squared paper to design a maze. 1 to initialize 1 to a string so it can go in 1 them together at the end. Futher tweaking will add more features. It may not always be convenient or possible to use this technique when writing programs but because of the nature of Interactive BASIC Programming we must use it here.Run the program found in this Learning Element. 1 t(2)=g(2) 1 t(1)=s(1)-1: 1 t(1),t(2); 1 statements to test for 1 statement. 1 statement is part of setting up the system since the main array will need to be clear-ed of old data." 1 somewherein 1 so that the mouth changes nexttime. Amend your program so thatit prints the proper gobble UDG. 1 should contain a number from 1 to 7 as a string. You canuse 1 should be set by the 1 score=maxdot 1 rather than 1 onwards. Clear screen and print options, wait for selection (key press 1 to 7), go to option. 1 only changes when the ghost bumps into a wall. Then it will be given a new value by repeating 1 mouth=0: 1 minus any trailing spaces. 1 maxdot=337 1 k 6410 1 j 1 iscopyright material. At 1 is the row) and the new position stored in 1 is not the position of the wall. 1 is 7 characters long. Only three comparisons are needed 1 is 5 characters long and 1 is 0 butis increased to give a closed mouth if 1 in order to get it back!" 1 i 1 i 1 hold the character code for either the up, down, left or right UDG withmouth open. To get the code of the required UDG we must add 1 has been found, use the print items 1 has been calculated check the value against 1 h(2)=g(2)+1: 1 h(1)=g(1): 1 h(1)=g(1)-1: 1 h(1),h(2); 1 h$ 1 g$ 4130 1 f$ 1110 1 etc). If so then 1 etc 1 direction = 145: 1 datanamea 1 could be tested. Its character code should be greaterthan 48 and less than 56. 1 colours the same. 1 colours are the same. Use 1 by one and ask for each item by way of 1 but this is impossible if 1 but onlyaccept a string of nine charact-ers or less. Then load 1 being 0, 1, 2, or 3and work out values for 1 because their 1 b$(i)=d$ 1 b$(4)="0" 1 b$(1);b$(2) 1 and waits for a key to be pressed. 1 and to clear the screen. 1 and then copy it onto paper. Save your BASIC to tape and look at the program found inthis Learning Element. 1 and the old position 1 and new value differ. 1 and gives a new direction to the ghost. 1 and Caught!! at line 1 a$(total,i)=g$ 4150 1 a$(k,heading)(i 1 a$(fileno,i)=h$ 1 a$(fileno,1); 1 a$(fileno,1) 1 a space atthe old position and " 1 a key must have been pressedand because the detection is so quick the user will still have her or his finger on the key. Sowe can add 1 You will end up with a reasonable filing system by the end of this Learning Module. We will build on ideas from Learning Module H. First of all let's decide what we could use a filing system for. Making the program as flexible as possible will enable it to be used for a variety of purposes. Here are some examples of the sorts of information we could store, retrieve, amend, etc: (i)names, addresses and telephone numbers. (ii)magazine articles. (iii)examination marks. (iv)chemical elements, their boiling points etc. (v)video library, tape number, position on tape etc. (vi)knitting patterns library. 1 You should be in a position to complete the ghost moving part. Try to do this. Write fromline 1 You may well have thought ofa problem not yet mentioned. What does the new gobble blob look like (eight blobs)? Well it has to be printed alternatelywith its mouth open and then closed. Does the character pointup, down, left or right? 1 You may not be able to see an advantage in a filing system yet. Indeed you may never have ause for one. This doesn't reallymatter though since the real purpose is to understand how a program is put together. 1 Write the maze part of the program starting at line 1 Write the fist part of this menu, i.e. the part that displays the options. 1 Write the complete program for option 1 (it's easy). 1 Write the BASIC that (a) moves the gobble blob if the next position ( 1 Write Option 6 but with themain searching loop empty (for now): 1 Work out the numbers for each UDG, store them in 1 We will write this filing program in eight separate parts (menu and seven options), savingeach part to tape when it is complete. Then we can combine the parts using 1 We will break down the game into several distinct parts, write each part separately and 1 We need to keep track of thedirection in which the ghost is travelling. Let's use 1 We have to detect illegal key presses and eliminate them. 1 Use one or more print statements to print "MENU" and the seven options plus a messageinstructing the user to press a key from 1 to 7. 1 Use a loop to input the headings. Make sure that the heading is not longer than 20 characters! 1 Use a loop to input each item for file 1 This Learning Module will show you how to write a Pack-Manstyle game, i.e. the maze game in which a small graphic character eats "energy pills" and is chased by a "ghost". 1 There are many ways to alter this game. You could add futher ghosts; have a series of different images (levels); havea second larger energy pill which when eaten allows the gobbler to eat ghosts for extra points. You could allow for several "lives". Perhaps there should be a time limit. Unless you've been very clever with the design of your maze, the ghost will not be able to goeverywhere so an additional bit of randomness may be useful. A tunnel that connects the sides of the maze should be easy enough to add. Remember that the more you add to the game (except for additional mazes) the slower things can move on the screen. 1 The walls of the maze shouldhave the same 1 The menu first. The options must be displayed when the program is run so the menu is written from line 1 The main loop exists from line 1 The gobble splurge and ghostwallah have to be given startingpositions and directions. In fact the arrays have yet to be declared (set up using 1 The ghost print statement has to be changed in order to print the correct UDG. The required codes are 153, 154, 155and 156. These can be calculatedas 1 The final program will give headings to each type of item e.g. telephone numbers, addresses, name. It will allow for setting up the array from tape so that some programs can deal with many forms of data. Naturally enough we will have toallow for saving the array to tape. The program should allow us to insert information and search for a given string. 1 The files will consist of data stored in a three- dimensional string array. We could use 1 The best way of accepting a key press is by using 1 Test Option 4 then save it. 1 Take your time and write Option 5. Keep testing whether what you have written so far actually does what you want it to do. 1 THEN PRINT PAPER 1 THEN LET 1 Suppose the ghost changes its position: (a) Has the gobbler been caught 1 So far we can display the options and respond to a selection. What will happen if the user presses a key other than 1 - 7? 1 Save your program (maze, dots, and UDGs) to tape. Now for moving the gobble blob: it can go up, down, left and right. Let these directions be selected by keys y, b, g and h (in the same order). You could chose other keys if you like. 1 Run your program and correctany errors. Save this on to tape using 1 Run option 1 to check it andthen 1 Remember to set up 1 RETURN: REM up 1 Place the gobbler far away from the ghost thing: 1 Patch the search loop into the other part of Option 6, testit and save it. 1 POKE USR 1 Option 5. Ask for file number. Print headings and old options, ask for new options buttake an input of 1 Option 4. Insert a file. 1 Option 3. This is virtuallythe same as Option 2, the main difference being 1 Option 2. In order to save array 1 Option 2 should end by informing the user that saving is complete and then return to the menu ( 1 Once the final value for 1 Now move gobble blob 1 Now for the ghost: it has tomove over any energy dots that may be in its way. The ghost follows an unchanging direction until it hits a wall. Making it take a random direction after it hits a wall will ensure that it will travel throughout the maze. 1 Now for the energy dots. Youwill need to design a user- defined graphic character. GRAPHIC A is " 1 Now for option 1. This begins at line 1 Now for Option 6. Search for a string. First ask for the heading under which the search is to be carried out ( 1 Note that the search will print out the file every time 1 Next, devise graphics characters for the gobble blob and the ghost. The gobble blob is seen with its mouth open and then closed; it moves up, down, left and right so we need eight UDGs for this. 1 Make sure that your BASIC checks for 1 Let's make the ghost's eyes look in the direction in which they move. Create UDGs for 1 Insert data into the filingsystem, become familiar with it and, finally, use it (or your own customized version of it)!ext Learnin 1 In order to allow the ghost to move over energy dots we willhave to store the contents (" " or " 1 If you create a software directory you might have one item for the software title, one for the software house that produced the program and one fora brief description of the software. You may then want to print out all the titles available from "ACME soft" or the titles that mention "adventure" in the description. If you are an active member of acomputer club you may wish to include a fourth item giving thename of the computer on which the software runs (for those poor souls without a Spectrum!).Obviously we will need to make aplan for such a large program. Run the program found in this Learning Element. 1 IF INKEY$ 1 Having produced the maze, ifwe cover the whole screen with 1 Go back to the plan and make sure that your program doeswhat it is supposed to do. 1 For UDG "a" use: 1 Don't bother to save Option 2 since: it is small you can save it with Option 3. Check that there are no errors in Option 2. 1 Complete the menu part of the program by adding a line to avoid illegal key presses. 1 Clear the screen, print 1 Check your program and then save it. 1 CLS FOR 1 By now you should be able to write something like this without help! Remember to get 1 Before we continue futher you had better know about 1 As it stands, this program will cause an error (variable not found) to occur because it will try to use mouth before it has been given a value (i.e. created!). To initialize (start off) this variable, enter: 1 Amend each item 1 A full listing of our version of this program can be found in this Learning Element. 1 9000 1 8000 1 8,0;"Select the heading under which the search is to be carried out (press 1-3)." 1 7) c$ 1 6;" ";b$(i) 1 6930 6920 1 6) c$ 1 5) c$ 1 4180 4160 1 4120 4140 1 4100 4150 1 3 4110 1 3 1 3 1 1;" score = 0 y-up b-down g-left h=right" 1 1 Set up the system 1 -1 6910 1 (your maze may have a different number of dots). 1 (direction) 1 "What is the heading ";i 1 "ENTER item ";i 4120 1 "ENTER ";b$(i) 1 "Amending with ENTER only will retain the old item" 1 search 1 instruct the Spectrum to use whatever colours are already present. Enter: 1 etc 1 but only accept a string of ninecharacters or less. Save main array under 1 Please note that whatfollows is only part of a program and cannot be expected to run in any meaningful way! 1 Finally, Option 7. List files. This is dead easy: find total from 1 A subroutine for calculating the new position is needed. This will use the direction 1 (we'll do the energy dots later) 1 xxxxxxx 1 xxxxx 1 statements. E.g. 1 onwards. 1 You may want to enhance this filing system by adding an alphabetical sort or listing just one item from all the files, or listing files from 1 (d) The ghost is moved. 1 statements and modify the loop at line 1 items and strings of spaces for sections of wall. Make the 1 Use numerical array 1 PRINT AT 1 Bill Biro (Steak & Kidney Pies) Ltd. 1 found then 1 colour, then we can use 1 You are now at the end of 1 This information is not intended to offend our customersbut to promote the development of good software. Thank you for reading this far! 1 statements). The maze that we have provided contains a ghostieshape and this is being used as a box to start the ghost blob off from. Add 1 Finally we need to deal with GAME OVER at line 1 Enter the BASIC from line 1 (a) If you have any reasonto believe that you have paid for a pirated copy of 1 onwards. 1 When all the dots have been eaten 1 NEXT 1 PRINT TAB 1 LET 1 FOR 1 (b) The old position restored 1 This records that another file has been (is about to be) created. Ask for each item by way of an input statement. By reference to the plan (or your notes), write Option 4. 1 PRINT 1 NEXT 1 statements. After printing, the new gobble blob, 1 LET 1 g() 1 a$() 1 LET 1 Write a subroutine that lives atline 1 LET 1 LET 1 PRINT 1 Update your program to do this. 1 Note that programming will be easier if you do not use a border as a wall, (remember SNAKEX). We will assume you havefollowed this advice. 1 LET 1 and then write BASIC from line 1 NEXT 1 NEXT 1 READ 1 PRINT 1 6200 1 (e) The new position becomes the current position. 1 LET 1 IF LEN 1 For the ghost, let its current position (which soon becomes theold position) be stored in 1 and add: 1 and then 1 120 1 INPUT 1 FOR 1 Study this very carefully. 1 1